﻿using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace TKT.Lifter.CIM.Lifter.Gui.Widget
{
    public partial class FloorTemplate : UserControl
    {
        private string floorNum = "1F";
        public FloorTemplate()
        {
            InitializeComponent();
        }

        public string FloorNum
        {
            get
            {
                return this.floorNum;
            }
            set
            {
                this.floorNum = value;
                base.Invalidate();
            }
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            this.DrawBody(e.Graphics);
        }
        private void DrawBody(Graphics g)
        {
            if (g == null)
            {
                g = base.CreateGraphics();
            }
            g.SmoothingMode = SmoothingMode.HighQuality;

            //绘制一段曲线
            int boder = 2;
            Pen pen = new Pen(Color.SlateBlue, 2);
            pen.DashStyle = DashStyle.Dash;

            g.DrawLine(pen, new Point(0, boder), new Point(this.Width, boder));

            //绘制楼层编号
            Font font = new Font("微软雅黑", 15F, FontStyle.Bold);
            g.DrawString(floorNum, font, Brushes.LightSlateGray, boder, this.Height / 2);
        }
    }
}
